// Copyright (c) 2007 Alistair Jones
// This program is made available under the terms of the MIT License.
package org.hypirinha.html.codegen;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.hypirinha.html.codegen.MemberExpectations.*;
import static org.hypirinha.html.codegen.MemberExpectations.member;

public class ConcreteMethodTest {

    @Test
    public void shouldRenderWithDoubleIndentedBody() {
        member(new ConcreteMethod("td", "Td", "TdContent... contents", "return newChild(new Td(contents));")).shouldRenderTo(
                line(""),
                line("    public Td td(TdContent... contents) {"),
                line("        return newChild(new Td(contents));"),
                line("    }")
        );
    }

    @Test
    public void shouldRenderModfiers() {
        ConcreteMethod method = new ConcreteMethod("td", "Td", "TdContent... contents", "return newChild(new Td(contents));");
        method.getModifiers().add("static");
        method.getModifiers().add("final");
        member(method).shouldRenderTo(
                line(""),
                line("    public static final Td td(TdContent... contents) {"),
                line("        return newChild(new Td(contents));"),
                line("    }")
        );
    }


}